{extend name="Index/index"}

{block name="main"}
    <!--个个栏目体  开始-->
    <div class="right-wrapper">
        <!--我的关注-->
        <div class="nav-show" style="display:block">
            {if condition="$follow == null"}
            <div style="display:block" class="no-like">
                <img src="/static/personal/img/collection.png" width="700">
                <p>
                    暂无关注，赶紧去关注吧
                </p>
            </div>
            {else /}
                <ul class="subscribe-list">
                    {volist name="follow" id="v"}
                        <li  class="subscribed">
                            <a href="/attention/{$v['buid']}" target="_blank">
                                {if ($v['icon'] == null)}
                                    <img src="/static/personal/img/batman.jpg" width="90">
                                {else /}
                                    <img src="{$v['icon']}" width="90">
                                {/if}
                                <p>{$v['nickname']}</p>
                            </a>
                            <button class="subscribe js-subscribe-btn" data-id="{$v['id']}">取消关注</button>
                        </li>
                    {/volist}
                </ul>
            {/if}
        </div>
    </div> <!--个个栏目体 结束-->
</div>  <!--main 结束-->
{js href="/static/home/js/jquery.min.js" /}
{js href="/static/home/js/bootstrap.js" /}
{js href="/static/personal/layui/layui.js"}
<script>
    $(function () {
        $('.subscribe').bind('click', function () {
            var id = $(this).attr('data-id');
            var _this = this;
            $.ajax({
                type: 'get',
                url: 'follow/' + id,
                dateType: 'json',
                success: function (data) {
                    if (data > 0) {
                        $(_this).parents('li').remove();
                    } else {
                        alert('取消收藏失败');
                    }
                },
                error: function () {
                    // AJAX执行失败
                    alert('ajax操作失败');
                }
            });
        });
    });

</script>

{/block}
